//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.sale;

import java.io.Serializable;
import java.math.BigDecimal;

public class SalesPiece
        implements Serializable {

    public SalesPiece() {
        prepared = false;
    }

    public SalesPiece(String id, String prefix, String date, String customerId, Integer salesPersonId, BigDecimal shippingPrice, BigDecimal netPrice,
            String dueDate, String deliveryDate, String deliveryMan, String reminderDate, BigDecimal partPayment, String methodeOfPayment, String clearDate,
            Integer compagnyId, Integer prepare, BigDecimal grossPrice, String notes, BigDecimal totalTax, BigDecimal tax1, BigDecimal tax2,
            BigDecimal tax3, BigDecimal tax4, BigDecimal tax5, String billReference, BigDecimal sendingId, String updateTime, BigDecimal shippingTax,
            String end, Integer numConsultSub, String updateUserId, Integer numConsultCC) {
        prepared = false;
        setId(id);
        setPrefix(prefix);
        setDate(date);
        setCustomerId(customerId);
        setSalesPersonId(salesPersonId);
        setShippingPrice(shippingPrice);
        setNetPrice(netPrice);
        setDueDate(dueDate);
        setDeliveryDate(deliveryDate);
        setDeliveryMan(deliveryMan);
        setReminderDate(reminderDate);
        setPartPayment(partPayment);
        setMethodeOfPayment(methodeOfPayment);
        setClearDate(clearDate);
        setCompagnyId(compagnyId);
        setPrepare(prepare);
        setGrossPrice(grossPrice);
        setNotes(notes);
        setTotalTax(totalTax);
        setTax1(tax1);
        setTax2(tax2);
        setTax3(tax3);
        setTax4(tax4);
        setTax5(tax5);
        setBillReference(billReference);
        setSendingId(sendingId);
        setUpdateTime(updateTime);
        setShippingTax(shippingTax);
        setUpdateUserId(updateUserId);
    }

    public SalesPiece(SalesPiece otherData) {
        prepared = false;
        setId(otherData.getId());
        setPrefix(otherData.getPrefix());
        setDate(otherData.getDate());
        setCustomerId(otherData.getCustomerId());
        setSalesPersonId(otherData.getSalesPersonId());
        setShippingPrice(otherData.getShippingPrice());
        setNetPrice(otherData.getNetPrice());
        setDueDate(otherData.getDueDate());
        setDeliveryDate(otherData.getDeliveryDate());
        setDeliveryMan(otherData.getDeliveryMan());
        setReminderDate(otherData.getReminderDate());
        setPartPayment(otherData.getPartPayment());
        setMethodeOfPayment(otherData.getMethodeOfPayment());
        setClearDate(otherData.getClearDate());
        setCompagnyId(otherData.getCompagnyId());
        setPrepare(otherData.getPrepare());
        setGrossPrice(otherData.getGrossPrice());
        setNotes(otherData.getNotes());
        setTotalTax(otherData.getTotalTax());
        setTax1(otherData.getTax1());
        setTax2(otherData.getTax2());
        setTax3(otherData.getTax3());
        setTax4(otherData.getTax4());
        setTax5(otherData.getTax5());
        setBillReference(otherData.getBillReference());
        setSendingId(otherData.getSendingId());
        setUpdateTime(otherData.getUpdateTime());
        setShippingTax(otherData.getShippingTax());
        setUpdateUserId(otherData.getUpdateUserId());
    }

    public String getPrimaryKey() {
        return getId();
    }

    public Integer getPrepare() {
        return prepare;
    }

    public void setPrepare(Integer prepare) {
        this.prepare = prepare;
        setPrepared(prepare.intValue());
    }

    public boolean isPrepared() {
        return prepared;
    }

    public void setPrepared(int prepared) {
        if (prepared == 0) {
            this.prepared = false;
        } else {
            this.prepared = true;
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public Integer getSalesPersonId() {
        return salesPersonId;
    }

    public void setSalesPersonId(Integer salesPersonId) {
        this.salesPersonId = salesPersonId;
    }

    public BigDecimal getShippingPrice() {
        return shippingPrice;
    }

    public void setShippingPrice(BigDecimal shippingPrice) {
        this.shippingPrice = shippingPrice;
    }

    public BigDecimal getNetPrice() {
        return netPrice;
    }

    public void setNetPrice(BigDecimal netPrice) {
        this.netPrice = netPrice;
    }

    public String getDueDate() {
        return dueDate;
    }

    public void setDueDate(String dueDate) {
        this.dueDate = dueDate;
    }

    public String getDeliveryDate() {
        return deliveryDate;
    }

    public void setDeliveryDate(String deliveryDate) {
        this.deliveryDate = deliveryDate;
    }

    public String getDeliveryMan() {
        return deliveryMan;
    }

    public void setDeliveryMan(String deliveryMan) {
        this.deliveryMan = deliveryMan;
    }

    public String getReminderDate() {
        return reminderDate;
    }

    public void setReminderDate(String reminderDate) {
        this.reminderDate = reminderDate;
    }

    public BigDecimal getPartPayment() {
        return partPayment;
    }

    public void setPartPayment(BigDecimal partPayment) {
        this.partPayment = partPayment;
    }

    public String getMethodeOfPayment() {
        return methodeOfPayment;
    }

    public void setMethodeOfPayment(String methodeOfPayment) {
        this.methodeOfPayment = methodeOfPayment;
    }

    public String getClearDate() {
        return clearDate;
    }

    public void setClearDate(String clearDate) {
        this.clearDate = clearDate;
    }

    public Integer getCompagnyId() {
        return compagnyId;
    }

    public void setCompagnyId(Integer compagnyId) {
        this.compagnyId = compagnyId;
    }

    public BigDecimal getGrossPrice() {
        return grossPrice;
    }

    public void setGrossPrice(BigDecimal grossPrice) {
        this.grossPrice = grossPrice;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public BigDecimal getTotalTax() {
        return totalTax;
    }

    public void setTotalTax(BigDecimal totalTax) {
        this.totalTax = totalTax;
    }

    public BigDecimal getTax1() {
        return tax1;
    }

    public void setTax1(BigDecimal tax1) {
        this.tax1 = tax1;
    }

    public BigDecimal getTax2() {
        return tax2;
    }

    public void setTax2(BigDecimal tax2) {
        this.tax2 = tax2;
    }

    public BigDecimal getTax3() {
        return tax3;
    }

    public void setTax3(BigDecimal tax3) {
        this.tax3 = tax3;
    }

    public BigDecimal getTax4() {
        return tax4;
    }

    public void setTax4(BigDecimal tax4) {
        this.tax4 = tax4;
    }

    public BigDecimal getTax5() {
        return tax5;
    }

    public void setTax5(BigDecimal tax5) {
        this.tax5 = tax5;
    }

    public String getBillReference() {
        return billReference;
    }

    public void setBillReference(String billReference) {
        this.billReference = billReference;
    }

    public BigDecimal getSendingId() {
        return sendingId;
    }

    public void setSendingId(BigDecimal sendingId) {
        this.sendingId = sendingId;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public BigDecimal getShippingTax() {
        return shippingTax;
    }

    public void setShippingTax(BigDecimal shippingTax) {
        this.shippingTax = shippingTax;
    }

    public String getUpdateUserId() {
        return updateUserId;
    }

    public void setUpdateUserId(String updateUserId) {
        this.updateUserId = updateUserId;
    }

    public String toString() {
        StringBuffer str = new StringBuffer("{");
        str.append("id=" + getId() + " " + "prefix=" + getPrefix() + " " + "date=" + getDate() + " " + "customerId=" + getCustomerId() + " " + "salesPersonId=" + getSalesPersonId() + " " + "shippingPrice=" + getShippingPrice() + " " + "netPrice=" + getNetPrice() + " " + "dueDate=" + getDueDate() + " " + "deliveryDate=" + getDeliveryDate() + " " + "deliveryMan=" + getDeliveryMan() + " " + "reminderDate=" + getReminderDate() + " " + "partPayment=" + getPartPayment() + " " + "methodeOfPayment=" + getMethodeOfPayment() + " " + "clearDate=" + getClearDate() + " " + "compagnyId=" + getCompagnyId() + " " + "prepare=" + getPrepare() + " " + "grossPrice=" + getGrossPrice() + " " + "notes=" + getNotes() + " " + "totalTax=" + getTotalTax() + " " + "tax1=" + getTax1() + " " + "tax2=" + getTax2() + " " + "tax3=" + getTax3() + " " + "tax4=" + getTax4() + " " + "tax5=" + getTax5() + " " + "billReference=" + getBillReference() + " " + "sendingId=" + getSendingId() + " " + "updateTime=" + getUpdateTime() + " " + "updateUserId=" + getUpdateUserId() + " " + "shippingTax=" + getShippingTax());
        str.append('}');
        return str.toString();
    }

    public boolean equals(Object pOther) {
        if (pOther instanceof SalesPiece) {
            SalesPiece lTest = (SalesPiece) pOther;
            boolean lEquals = true;
            if (id == null) {
                lEquals = lEquals && lTest.id == null;
            } else {
                lEquals = lEquals && id.equals(lTest.id);
            }
            if (prefix == null) {
                lEquals = lEquals && lTest.prefix == null;
            } else {
                lEquals = lEquals && prefix.equals(lTest.prefix);
            }
            if (date == null) {
                lEquals = lEquals && lTest.date == null;
            } else {
                lEquals = lEquals && date.equals(lTest.date);
            }
            if (customerId == null) {
                lEquals = lEquals && lTest.customerId == null;
            } else {
                lEquals = lEquals && customerId.equals(lTest.customerId);
            }
            if (salesPersonId == null) {
                lEquals = lEquals && lTest.salesPersonId == null;
            } else {
                lEquals = lEquals && salesPersonId.equals(lTest.salesPersonId);
            }
            if (shippingPrice == null) {
                lEquals = lEquals && lTest.shippingPrice == null;
            } else {
                lEquals = lEquals && shippingPrice.equals(lTest.shippingPrice);
            }
            if (netPrice == null) {
                lEquals = lEquals && lTest.netPrice == null;
            } else {
                lEquals = lEquals && netPrice.equals(lTest.netPrice);
            }
            if (dueDate == null) {
                lEquals = lEquals && lTest.dueDate == null;
            } else {
                lEquals = lEquals && dueDate.equals(lTest.dueDate);
            }
            if (deliveryDate == null) {
                lEquals = lEquals && lTest.deliveryDate == null;
            } else {
                lEquals = lEquals && deliveryDate.equals(lTest.deliveryDate);
            }
            if (deliveryMan == null) {
                lEquals = lEquals && lTest.deliveryMan == null;
            } else {
                lEquals = lEquals && deliveryMan.equals(lTest.deliveryMan);
            }
            if (reminderDate == null) {
                lEquals = lEquals && lTest.reminderDate == null;
            } else {
                lEquals = lEquals && reminderDate.equals(lTest.reminderDate);
            }
            if (partPayment == null) {
                lEquals = lEquals && lTest.partPayment == null;
            } else {
                lEquals = lEquals && partPayment.equals(lTest.partPayment);
            }
            if (methodeOfPayment == null) {
                lEquals = lEquals && lTest.methodeOfPayment == null;
            } else {
                lEquals = lEquals && methodeOfPayment.equals(lTest.methodeOfPayment);
            }
            if (clearDate == null) {
                lEquals = lEquals && lTest.clearDate == null;
            } else {
                lEquals = lEquals && clearDate.equals(lTest.clearDate);
            }
            if (prepare == null) {
                lEquals = lEquals && lTest.prepare == null;
            } else {
                lEquals = lEquals && prepare.equals(lTest.prepare);
            }
            if (compagnyId == null) {
                lEquals = lEquals && lTest.compagnyId == null;
            } else {
                lEquals = lEquals && compagnyId.equals(lTest.compagnyId);
            }
            if (grossPrice == null) {
                lEquals = lEquals && lTest.grossPrice == null;
            } else {
                lEquals = lEquals && grossPrice.equals(lTest.grossPrice);
            }
            if (notes == null) {
                lEquals = lEquals && lTest.notes == null;
            } else {
                lEquals = lEquals && notes.equals(lTest.notes);
            }
            if (totalTax == null) {
                lEquals = lEquals && lTest.totalTax == null;
            } else {
                lEquals = lEquals && totalTax.equals(lTest.totalTax);
            }
            if (tax1 == null) {
                lEquals = lEquals && lTest.tax1 == null;
            } else {
                lEquals = lEquals && tax1.equals(lTest.tax1);
            }
            if (tax2 == null) {
                lEquals = lEquals && lTest.tax2 == null;
            } else {
                lEquals = lEquals && tax2.equals(lTest.tax2);
            }
            if (tax3 == null) {
                lEquals = lEquals && lTest.tax3 == null;
            } else {
                lEquals = lEquals && tax3.equals(lTest.tax3);
            }
            if (tax4 == null) {
                lEquals = lEquals && lTest.tax4 == null;
            } else {
                lEquals = lEquals && tax4.equals(lTest.tax4);
            }
            if (tax5 == null) {
                lEquals = lEquals && lTest.tax5 == null;
            } else {
                lEquals = lEquals && tax5.equals(lTest.tax5);
            }
            if (billReference == null) {
                lEquals = lEquals && lTest.billReference == null;
            } else {
                lEquals = lEquals && billReference.equals(lTest.billReference);
            }
            if (sendingId == null) {
                lEquals = lEquals && lTest.sendingId == null;
            } else {
                lEquals = lEquals && sendingId.equals(lTest.sendingId);
            }
            if (updateTime == null) {
                lEquals = lEquals && lTest.updateTime == null;
            } else {
                lEquals = lEquals && updateTime.equals(lTest.updateTime);
            }
            if (shippingTax == null) {
                lEquals = lEquals && lTest.shippingTax == null;
            } else {
                lEquals = lEquals && shippingTax.equals(lTest.shippingTax);
            }
            if (updateUserId == null) {
                lEquals = lEquals && lTest.updateUserId == null;
            } else {
                lEquals = lEquals && updateUserId.equals(lTest.updateUserId);
            }
            return lEquals;
        } else {
            return false;
        }
    }

    public int hashCode() {
        int result = 17;
        result = 37 * result + (id == null ? 0 : id.hashCode());
        result = 37 * result + (prefix == null ? 0 : prefix.hashCode());
        result = 37 * result + (date == null ? 0 : date.hashCode());
        result = 37 * result + (customerId == null ? 0 : customerId.hashCode());
        result = 37 * result + (salesPersonId == null ? 0 : salesPersonId.hashCode());
        result = 37 * result + (shippingPrice == null ? 0 : shippingPrice.hashCode());
        result = 37 * result + (netPrice == null ? 0 : netPrice.hashCode());
        result = 37 * result + (dueDate == null ? 0 : dueDate.hashCode());
        result = 37 * result + (deliveryDate == null ? 0 : deliveryDate.hashCode());
        result = 37 * result + (deliveryMan == null ? 0 : deliveryMan.hashCode());
        result = 37 * result + (reminderDate == null ? 0 : reminderDate.hashCode());
        result = 37 * result + (partPayment == null ? 0 : partPayment.hashCode());
        result = 37 * result + (methodeOfPayment == null ? 0 : methodeOfPayment.hashCode());
        result = 37 * result + (clearDate == null ? 0 : clearDate.hashCode());
        result = 37 * result + (compagnyId == null ? 0 : compagnyId.hashCode());
        result = 37 * result + (prepare == null ? 0 : prepare.hashCode());
        result = 37 * result + (grossPrice == null ? 0 : grossPrice.hashCode());
        result = 37 * result + (notes == null ? 0 : notes.hashCode());
        result = 37 * result + (totalTax == null ? 0 : totalTax.hashCode());
        result = 37 * result + (tax1 == null ? 0 : tax1.hashCode());
        result = 37 * result + (tax2 == null ? 0 : tax2.hashCode());
        result = 37 * result + (tax3 == null ? 0 : tax3.hashCode());
        result = 37 * result + (tax4 == null ? 0 : tax4.hashCode());
        result = 37 * result + (tax5 == null ? 0 : tax5.hashCode());
        result = 37 * result + (billReference == null ? 0 : billReference.hashCode());
        result = 37 * result + (sendingId == null ? 0 : sendingId.hashCode());
        result = 37 * result + (updateTime == null ? 0 : updateTime.hashCode());
        result = 37 * result + (shippingTax == null ? 0 : shippingTax.hashCode());
        result = 37 * result + (updateUserId == null ? 0 : updateUserId.hashCode());
        return result;
    }
    private String id;
    private String prefix;
    private String date;
    private String customerId;
    private Integer salesPersonId;
    private BigDecimal shippingPrice;
    private BigDecimal netPrice;
    private String dueDate;
    private String deliveryDate;
    private String deliveryMan;
    private String reminderDate;
    private BigDecimal partPayment;
    private String methodeOfPayment;
    private String clearDate;
    private Integer compagnyId;
    private Integer prepare;
    private BigDecimal grossPrice;
    private String notes;
    private BigDecimal totalTax;
    private BigDecimal tax1;
    private BigDecimal tax2;
    private BigDecimal tax3;
    private BigDecimal tax4;
    private BigDecimal tax5;
    private String billReference;
    private BigDecimal sendingId;
    private String updateTime;
    private BigDecimal shippingTax;
    private String updateUserId;
    private boolean prepared;
}
